<!--suppress ALL -->
<include file="./Template/header.html" />
<link rel="stylesheet" type="text/css" href="/Template/css/orderList.css">
<script type="text/javascript">

    $(function() {

        //初始化页面配置
        initPage("我的订单");

        var app = new Vue({
            el: '#container',
            data: {
                orderList: [],
            },
            methods: {
//                payInfo: function(id) {
//                    window.location.href = "/wechat/userCenter/payInfo/id/"+id;
//                },
            }
        })

        function getOrderList(status) {

            $.ajax({
                url:"/wechat/finishedProduct/myOrderList",
                type:"post",
                data:{
                    status: status,
                    orderId: '{$orderId}'
                },
                dataType:"JSON",
                beforeSend:function(){
                    $("#loadingToast").show();
                },
                complete:function(){
                    $('#loadingToast').hide();
                },
                success:function(data){
                    app.orderList = data;
                    setTimeout(function() {
                        $(".ui-item.measure-info img").bind("click", function() {
                            var upUrl = "/Template/images/icon-up.png";
                            var downUrl = "/Template/images/icon-down.png";
                            $(this).parent().next().toggle();
                            if($(this).attr("src") == upUrl) {
                                $(this).attr("src", downUrl);
                            } else {
                                $(this).attr("src", upUrl);
                            }
                        });
                        $(".ui-item.measure-info img").each(function() {
                            $(this).trigger("click");
                        });
                    },200);
                },
            })
        }

        $("#my-order ul li").bind("click", function() {

            if($(this).hasClass("active")) {
                return false;
            }

            var status = $(this).attr("data-status");

            $("#my-order ul li").each(function() {
                $(this).removeClass("active");
            });

            $(this).addClass("active");

            getOrderList(status);

        });

        getOrderList(-1);

    });


</script>
<div class="container" id="container">
    <div id="my-order">
        <ul>
            <li class="active" data-status="-1">
                <span>待处理</span>
            </li>
            <li data-status="1">
                <span>已出库</span>
            </li>
            <li data-status="0">
                <span>全部</span>
            </li>
        </ul>
    </div>
    <div class="order-detail">
        <div class="no-data" v-if="orderList == null")>暂无数据</div>
        <div class="order-info" v-for="order in orderList">
            <div class="status active" v-if="order.status == -1">
                <img src="/Template/images/icon-waiting.png" alt="">
                <span class="status-content">{{order.employee_name}} (待处理)</span>
            </div>
            <div class="status active" v-if="order.status == 1">
                <img src="/Template/images/icon-clock.png" alt="">
                <span class="status-content">{{order.employee_name}} (已出库)</span>
            </div>
            <div class="have-padding">
                <div class="product-info">
                    <img class="product-img" src="{{order.image_url}}" alt="product">
                    <div class="detail-info">
                        <p class="product-price">￥{{order.sale_price}}</p>
                        <p class="product-name">{{order.finished_product_name}}</p>
                        <p class="number">×{{order.number}}</p>
                        <p class="buy-time">{{order.create_time}}</p>

                    </div>
                    <div>
                        <p class="singlePrice">原单价：{{order.single_price}}</p>
                        <p class="sum">共 {{order.number}} 件商品 合计:<span style="color: #d92f3b;">￥{{order.total_price}}</span></p>
                    </div>

                </div>
                <div class="line"></div>
                <div class="user-order-info">
                    <div class="ui-item pickUp-info">
                        <span class="item-left">单号</span>
                        <span class="item-right">{{order.finished_order_no}}</span>
                    </div>
                    <div class="ui-item pickUp-info">
                        <span class="item-left">规格</span>
                        <span class="item-right">{{order.size}}</span>
                    </div>
                    <div v-if="order.agent_name == '无' || order.agent_name == '' || order.patient_name != ''">
                        <div class="ui-item pickUp-info">
                            <span class="item-left">客户名称</span>
                            <span class="item-right">{{order.customer_name}}</span>
                        </div>
                        <div class="ui-item pickUp-info">
                            <span class="item-left">患者信息</span>
                            <span class="item-right">姓名：{{order.patient_name}}，{{order.patient_sex}}，年龄：{{order.patient_age}}</span>
                        </div>
                        <div class="ui-item pickUp-info">
                            <span class="item-left">医生信息</span>
                            <span class="item-right">{{order.doctor_name}}({{order.hospital_name}})</span>
                        </div>
                    </div>
                    <div v-if="order.agent_name != '无' && order.agent_name != ''">
                        <div class="ui-item pickUp-info">
                            <span class="item-left">代理商</span>
                            <span class="item-right">{{order.agent _name}}</span>
                    </div>
                </div>
                <div class="finishedProduct-detail-info">
                    <div class="ui-item measure-info">
                        <span class="item-class">[{{order.delivery_type}}]</span>
                        <span class="item-detailname">详细信息</span>
                        <img class="icon-up" src="/Template/images/icon-up.png" alt="">
                    </div>
                    <div>
                        <!--<div class="ui-item pick-own-address" v-if="order.delivery_type == '自提'">-->
                            <!--<span class="item-left">自提地址</span>-->
                            <!--<span class="item-right">{{order.receive_address}}</span>-->
                        <!--</div>-->
                        <!--<div class="ui-item pickUp-address" v-else>-->
                            <!--<span class="item-left">收件人</span>-->
                            <!--<span class="item-right">{{order.receive_name}}</span>-->
                        <!--</div>-->
                        <div class="ui-item pickUp-address">
                            <span class="item-left">收件人</span>
                            <span class="item-right">姓名：{{order.receive_name}}，电话：{{order.receive_contact}}</span>
                        </div>
                        <div v-if="order.delivery_type == '快递'">
                            <div class="ui-item pickUp-address">
                                <span class="item-left">收件地址</span>
                                <span class="item-right">{{order.receive_address}}</span>
                            </div>
                        </div>
                        <div class="ui-item invoice-name" v-if="order.need_invoice == 2">
                            <span class="item-left">发票类型</span>
                            <span class="item-right">个人</span>
                        </div>
                        <div class="ui-item invoice-name" v-if="order.need_invoice == 1">
                            <span class="item-left">发票抬头</span>
                            <span class="item-right">{{order.invoice_name}}</span>
                        </div>
                        <div class="ui-item invoice-name" v-if="order.need_invoice == 1">
                            <span class="item-left">纳税人识别号</span>
                            <span class="item-right">{{order.invoice_number}}</span>
                        </div>
                        <div class="ui-item invoice-name" v-if="order.need_invoice != -1">
                            <span class="item-left">发票明细</span>
                            <span class="item-right">{{order.invoice_detail}}</span>
                        </div>
                        <div class="ui-item messege-left">
                            <span class="item-left">留言备注</span>
                            <span class="item-right">{{order.note == "" ? "暂无":order.note}}</span>
                        </div>
                        <div class="ui-item fast-post" v-if="order.status == 1 && order.delivery_type == '快递'">
                            <span class="item-left">{{order.express_company}}</span>
                            <span class="item-right">{{order.delivery_name}}：{{order.delivery_number}}</span>
                        </div>
                    </div>
                </div>
            </div>

        </div>

    </div>

</div>

<include file="./Template/footer.html" />

